package com.pay.prjo;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

/**  */
@Configuration
@PropertySource(value = "classpath:alipayTemplate.properties", encoding = "UTF-8")
public class AliPayTemplate {

  /** 在支付宝创建的应用ID */
  public static String appId;
  /** 商户私钥 */
  public static String merchantPrivateKey;
  /** 支付宝公钥 - 查看地址： https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥 */
  public static String alipayPublicKey;
  /** 签名方式 */
  public static String signType;
  /** 字符编码格式 */
  public static String charset;
  /** 支付宝网关； https://openapi.alipaydev.com/gateway.do */
  public static String gatewayUrl;

  @Value("${pay.alibaba.appid}")
  private void setAppId(String appId) {
    AliPayTemplate.appId = appId;
  }

  @Value("${pay.alibaba.merchantPrivateKey}")
  public void setMerchantPrivateKey(String merchantPrivateKey) {
    AliPayTemplate.merchantPrivateKey = merchantPrivateKey;
  }

  @Value("${pay.alibaba.alipayPublicKey}")
  private void setAlipayPublicKey(String alipayPublicKey) {
    AliPayTemplate.alipayPublicKey = alipayPublicKey;
  }

  @Value("${pay.alibaba.signType}")
  private void setSignType(String signType) {
    AliPayTemplate.signType = signType;
  }

  @Value("${pay.alibaba.charset}")
  private void setCharset(String charset) {
    AliPayTemplate.charset = charset;
  }

  @Value("${pay.alibaba.gatewayUrl}")
  private void setGatewayUrl(String gatewayUrl) {
    AliPayTemplate.gatewayUrl = gatewayUrl;
  }
}
